# Maintainer: Sven-Hendrik Haase <svenstaro@archlinux.org>
# Maintainer: Konstantin Gizdov (kgizdov) <arch@kge.pw>

pkgname=python-tensorflow-estimator
pkgver=2.14.0
pkgrel=1
pkgdesc="A high-level TensorFlow API that greatly simplifies machine learning programming"
url="https://github.com/tensorflow/estimator"
license=('APACHE')
arch=('any')
depends=('python-wrapt')
makedepends=('bazel' 'python-installer' 'python-setuptools' 'python-tensorflow' 'python-wheel')
source=("${pkgname}-${pkgver}.tar.gz::https://github.com/tensorflow/estimator/archive/v${pkgver}.tar.gz")
sha512sums=('a2ac534acba806177400c18968a3d5384a30e4fd431eb3b9f4e1542220b1e382e9272be9909f14d6984d50591b155be5eef7051620a9133ffd199bd1e6fe4582')

build() {
  cd estimator-${pkgver}

  bazel build //tensorflow_estimator/tools/pip_package:build_pip_package
  bazel-bin/tensorflow_estimator/tools/pip_package/build_pip_package "${srcdir}/estimator_pip"
}

check() {
  cd estimator-${pkgver}

  # Of course, upstream doesn't care about working tests...
  # Revisit this at some point.
  # bazel test //tensorflow_estimator/...
}

package() {
  cd estimator-${pkgver}

  WHEEL_PACKAGE=$(find "$srcdir"/estimator_pip -name "tensor*.whl")
  python -m installer --destdir="$pkgdir" $WHEEL_PACKAGE
}
